package com.ldc.work_1203.util;

import java.util.List;

public class PagerUtil<T> {
        //要结果数据
        //要每页条数
        //要当前页数
        //总共条数（符合条件的总共条数）
        //符合条件的总页数
        private List<T> list; //数据
        private int pageSize; //每页条数
        private int currentPage; //当前页
        private long total; //总条数
        private long totalPage; //总页数
        private long begin;
        private long end;

        public long getBegin() {
            return begin;
        }

        public void setBegin(long begin) {
            this.begin = begin;
        }

        public long getEnd() {
            return end;
        }

        public void setEnd(long end) {
            this.end = end;
        }

        public List<T> getList() {
            return list;
        }

        public void setList(List<T> list) {
            this.list = list;
        }

        public int getPageSize() {
            return pageSize;
        }

        public void setPageSize(int pageSize) {
            this.pageSize = pageSize;
        }

        public int getCurrentPage() {
            return currentPage;
        }

        public void setCurrentPage(int currentPage) {
            this.currentPage = currentPage;
        }

        public long getTotal() {
            return total;
        }

        public void setTotal(long total) {
            this.total = total;
            // 总页数
            this.totalPage = this.total % this.pageSize > 0 ? this.total / this.pageSize + 1 : this.total / this.pageSize;
        }

        public long getTotalPage() {
            return totalPage;
        }

        @Override
        public String toString() {
            return "Pager1 [list=" + list + ", pageSize=" + pageSize + ", currentPage=" + currentPage + ", total=" + total
                    + ", totalPage=" + totalPage + "]";
        }


}
